import CryptoJS from 'crypto-js';

// 加密密钥，前后端需保持一致 场地必须大于16位
const secretKey = 'abcdefghijklmnop';

export function encryptData(data) {
    const encrypted = CryptoJS.AES.encrypt(JSON.stringify(data), secretKey).toString();
    return encrypted;
}
export function encryptStr(dataStr) {
    const encrypted = CryptoJS.AES.encrypt(dataStr, secretKey).toString();
    return encrypted;
}